<script>
$(document).ready(function(){
    $('.bt_cm').click(function(){
        $('#loading').css('display','block');
       var fullname = $('#fullname').val();
       var captcha = $('#captcha').val();
       var word = $('.captchar').attr('id');
       var nd = $('#cm_content').val();
       if(nd == '' || fullname == '' || captcha ==''){
        alert('Bạn chưa điền đầy đủ các trường !!!');
        return false;
       }
       if(captcha != word){
        alert('Mã xác nhận không chính xác !!!');
        return false;
       }
       else{
           $.ajax({
                url: '<?php echo $this->url(array('module'=>'default','controller'=>'index','action'=>'add'));?>',
                type: "post",
                data: "nd="+nd+'&fullname='+fullname,
                success :function(result) {
                    $('#loading').css('display','none');
                    $('.cmnd').html(result);
                    return false;
                }
           });
       }
    });
});
</script>
<div class="chim">
</div>
<div class="main_comment">
  <h3 style="margin-top: -84px;">Gửi lời chúc tới Hoàng &amp; Mai</h3>
<form action="" method="post" onsubmit="return false" style="margin:5% 0% 0% 23%">
<span style="color: white;">Họ tên</span><span style="margin-left: 182px;color: white;">Nội dung</span>   
    <div class="fullname" style="margin-bottom: 8px;">
        <?php echo $this->formText('fullname', $this->fullnameValue, 
        array('id' => 'fullname', 'class' => 'input','style'=>'width:200px;height:25px;'));?>
    </div>
<span style="color: white;">Mã xác nhận</span>   
    <div class="captchar" id="<?php echo $this->word?>">
        <?php echo $this->formText('captcha', null, array('captcha_id'=> $this->captchaID, 'class' => 'input','style'=>'width:80px;height:25px;'));
                  echo $this->formHidden('captcha_id',$this->captchaID);?>       
    </div> 
    <div class="image_captchar" style="margin: -40px 0px 0px 98px;">
        <?php echo $this->captcha; ?>
    </div>
    <div class="cm_content" style="margin: -80px 0px 0px 221px;">
        <?php echo $this->formTextarea('cm_content',null,array('cols' => '30', 'rows' => '8', 'id' => 'cm_content','style' => 'resize:none;'))?>
    </div>
    <div >
        <?php echo $this->formSubmit('submit', null, array('class' => 'bt_cm')); ?>
    </div>
</form>
</div>
<div class="cmnd">
<?php 	
$congratulations = new Default_Model_Congratulations();
foreach($this->data as $value) :
?>
 <div class="item">
         
         <div class="item_content">
         <span style="color: rgb(9, 69, 175);font-weight: bold;">
            <?php echo $congratulations->nicetime($value['create_time']);?><br />
         </span>
         <span><?php echo $value['content']?></span>
         
         </div>
         <div class="tg">
         </div>
         <div class="item_fullname"> <?php echo $value['fullname']?></div>
         
</div>
<?php endforeach;?>
<?php if(!empty($this->data) && (count($this->data > 0))) : ?>
    <div class="phantrang">
        <?php echo $this->paginationControl($this->data, 'Sliding', 'index/pagination.phtml'); ?>
    </div>
    <?php endif; ?>
</div>
<div id="loading">Đang tải dữ liệu...</div>
